<!--顶部搜索&LOGO-->
@inject('solrService','App\Interfaces\SolrService')

@inject('keywordsService','App\Interfaces\KeywordsService')

<?php $hotKeywords = $solrService->suggest('',7); ?>

<?php if (isset($filter['keyword'])&&$filter['keyword']!='') {$keyword=$filter['keyword'];}else{$keyword=$hotKeywords->first()['keyword'];}?>
<div class="ui-box1 inbox h-search fn-clear fn-rel <?php if(!isset($noTopNav)){ echo 'has-cart'; } ?>">
    <div class="fn-fr">
        <!--搜索框-->
        <div class="search-box <?php if(isset($noTopNav)){ echo 'fn-mt14'; } ?>">
            {!! Form::open(['url'=>'/search?','class'=>'bl-form search-skin1','method'=>'get','target'=>'_blank']) !!}
            <div class="fn-dib fn-rel fn-ohide keybox">
                <input type="text" name="keyword" data-url="/search/suggestion" placeholder="{{$keyword}}" autocomplete="off" class="js-autocomplete fn-tinput fn-tinput-long key fn-fl">
                <span class="fn-dib submit">
                            <button class="fn-btn btn-submit" type="submit">搜 索</button>
                        </span>
                <i class="icon icon-search fn-abs"></i>
            </div>
            {!! Form::close() !!}
        </div>
        <!--END/搜索框-->

    @if( !isset($noTopNav) )
        <!--购物车-->
            <a target="_blank" href="/cart" rel="nofollow" class="t-shopcart">
                <i class="icon icon-cart fn-mt4"></i>
                <span class="wrap js-cart">购物车<b class="num fn-dib cart-num">{{$total_number}}</b></span>
            </a>
            <!--END/购物车-->

            <!--热门标签-->
            <div class="hot-keys fn-mt10 fn-hide">
                @foreach( $hotKeywords as $k=>$keyword)
                    <a href="/search?<?php echo 'keyword='.urlencode($keyword['keyword']); ?>" target="_blank" class="link @if($k%2==1) text-color-1 @endif">{{$keyword['keyword']}}</a>
                    @if($hotKeywords->last()!=$keyword)<span>|</span>@endif
                @endforeach
            </div>
            <div class="hot-keys fn-mt10">
                <?php //dd($keywordsService->getKeywords());?>
                @foreach($keywordsService->getKeywords() as $key=>$keywords)
                <a href="/search?<?php echo 'keyword='.urlencode($keywords->name); ?>" target="_blank" class="link @if($key%2==0) text-color-1 @endif">{{$keywords->name}}</a>
                @if($key != count($keywordsService->getKeywords()->toArray())-1)
                    <span>|</span>
                @endif
                @endforeach


            </div>
            <!--END/热门标签-->
        @endif

    </div>